package com.autonavi.yunda.yunji.core.config;

import com.google.common.collect.Sets;

import java.util.Set;

/**
 * @author cizhong.wcs
 * @date 2022/6/27 10:54
 */
public interface EngineConstant {


    String CONSTANT_VALUE_REF = "常量引用";

    String DYNAMIC_CONFIG_REF = "动态变量";

    String ENGINE_REAL_OUTPUT = "_realOutput";

    String DEBUG_EXEC_SUCCESS = "success";

    String DEBUG_EXEC_FAIL = "fail";

    String GROOVY_SYNTAX_VARIABLE_REGEX = "^[A-Za-z]{1}[\\w]*$";

    String NODE_PARAM_NAME_REGEX = "^[A-Za-z]{1}[\\w-]*$";

    String EXPORT_RESULT_FLAG = "_export";
    String PROTOBUF = "_protobuf";
    String CUSTOM_RESPONSE = "_custom_response";

    String OUTPUT_FUN_NAME = "__output";
    String RESPONSE_FUN_NAME = "__response";
    String TRACE_LOG_FUN_NAME = "__traceLog";
    String RESPONSE_HEADERS_FUN_NAME = "__response_headers";
    String PARAM_VALIDATE_FUN_NAME = "__paramValidate";
    String CONTEXT_PARAM_NAME = "__context";
    String SCRIPT_PARAMS_MAP_NAME = "__scriptParamsMap";
    String DEBUG_LOG_PARAM_NAME = "__singleDebugLog";
    String EXEC_PROCESS = "process";
    String EXEC_GET_PROPERTY_PROCESS = "getProperty";
    String EXEC_SET_PROPERTY_PROCESS = "setProperty";
    String EXEC_VALIDATOR_RESULT_PROCESS = "validator_result_process";
    String EXEC_LOG_DEBUG_INFO_PROCESS = "log_debug_info";
    String FUNCTION_VERSION_SEPARATOR = "_#_";

    Set<String> INVALID_VAR_NAME_SET = Sets.newHashSet(
            "private", "protected", "public", "abstract", "class", "extends", "final",
            "implements", "interface", "native", "new", "static", "strictfp", "synchronized",
            "transient", "volatile", "break", "continue", "return", "do", "while", "if", "else",
            "for", "instanceof", "switch", "case", "default", "try", "catch", "throw", "throws",
            "import", "package", "boolean", "byte", "char", "double", "float", "int", "long",
            "short", "null", "true", "false", "super", "this", "void", "goto", "const",
            "setProperty", "getProperty", "invokeMethod",
            "setMetaClass", "getMetaClass",
            OUTPUT_FUN_NAME, RESPONSE_FUN_NAME, PARAM_VALIDATE_FUN_NAME, CONTEXT_PARAM_NAME,
            TRACE_LOG_FUN_NAME, SCRIPT_PARAMS_MAP_NAME, DEBUG_LOG_PARAM_NAME,
            "log"
    );
}
